package com.lovo.controller;

import com.lovo.model.ClassDO;
import com.lovo.model.StudentDO;
import com.lovo.service.IClassService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * Description:
 *
 * @author LiuChengQi
 * @date Created on 2020/11/22
 */
@Controller
@RequestMapping("/class")
public class ClassController {
    @Resource
    private IClassService service;




    @GetMapping
    public List findAll(String name){
        System.out.println(name);
        return service.findAll();
    }
    @PostMapping
    public String save(ClassDO classDO){
        service.save(classDO);
        return "增加";
    }
    @PutMapping("/{id}")
    public String update(@PathVariable("id") String id, @RequestBody ClassDO classDO){
        System.out.println("id:"+classDO);
        classDO.setId(id);
        service.update(classDO);
        return "update : "+classDO;
    }
    @DeleteMapping("/{id}")
    public String delete(@PathVariable("id") String id){
        service.remove(id);
        return "delete "+id;
    }





















}
